<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			html,
			body {
				height: 100%;
				margin: 0;
				padding: 0
			}
			
			ul,
			li {
				text-indent: 0;
				text-decoration: none;
				margin: 0;
				padding: 0
			}
			
			img {
				border: 0
			}
			
			body {
				background-color: #white;
				color: #999;
				font: 100%/18px helvetica, arial, sans-serif
			}
			
			canvas {
				cursor: crosshair;
				display: block;
				left: 0;
				position: absolute;
				top: 0;
				z-index: 20
			}
			/*<script type="text/javascript" src="js/jquery-2.0.0.min.js"></script>
<script type="text/javascript" src="js/texiao.js"></script>*/
			
			<style>.footer {
				position: absolute;
				bottom: 0;
				width: 100%;
				height: 100px;
				background-color: #ffc0cb;
			}
			
			.a2 {
				list-style-type: none;
				margin: 0;
				padding: 0;
				width: 120px;
				height: 500px;
				background-color: black
			}
			
			.a1 {
				display: block;
				color: #000;
				padding: 8px 16px;
				text-decoration: none;
			}
			/* 鼠标移动到选项上修改背景颜色 */
			
			.a1:hover {
				background-color: #555;
				color: white;
			}
			
			.footer {
				position: absolute;
				bottom: 0;
				width: 100%;
				height: 100px;
				background-color: #ffc0cb;
			}
		</style>

		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

		<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
	</head>

	<body style="background: ) ;background-size:cover; ">
		<script type="text/javascript">
		</script>
		<div class="container">

			<div class="row clearfix">
				<div class="col-md-12 ">

				</div>
				<ol class="navbar navbar-inverse" id="info">

					<div class="col-md-7">
						<ul class="nav nav-tabs">
							<li role="presentation" class="active">
								<a href="#">视频</a>
								</a>
							</li>
							<li role="presentation">
								<a href="#">热搜</a>
							</li>
							<li role="presentation">
								<a href="#">收藏</a>
							</li>
							<li role="presentation">
								<a href="#">分类</a>
							</li>
							<li role="presentation">
								<li role="presentation">
									<a href="#">空间</a>
								</li>
								<li role="presentation">
									<a href="#">换肤</a>
								</li>

								<a align="center" style="color: red;">这个世界很酷~</a>
						</ul>
					</div>

					<!--  -->

					<div class="col-md-5">
						<ul class="nav nav-tabs">
							<li>
								<a>
									<img src="images/定位.jpg" height="20px" width="20px"> 大连[切换]
								</a>
							</li>

							<li role="presentation">
								<a>
									<img src="images/语言.jpg" width="20px" height="20px" />
									<select name="language">
										<option value="">language</option>
										<option value="">中文</option>
										<option value="">英语</option>
										<option value="">西班牙语</option>
										<option value="">俄罗斯语</option>
										<option value="">孟加拉语</option>
										<option value="">阿拉伯语</option>
										<option value="">印度语</option>
										<option value="">日语</option>
										<option value="">法语</option>
										<option value="">德语</option>
										<option value="">点击查看更多语言</option>
									</select>
								</a>
							</li>
							<li role="presentation">
								<a href="#">客服</a>
							</li>

						</ul>

					</div>

			</div>
		</div>
		</div>
		<!-- 主题内容-->
		<a style="color:red">提示：无聊的时候可以玩一玩休闲小游戏奥： </a>&nbsp;&nbsp;
		<a href="剪刀石头布.html">剪刀石头布</a>
		&nbsp;&nbsp;
		<a href="俄罗斯方块.html">俄罗斯小方块</a>
		<!-- 网页主题内容 -->

		<div class="row" style="background-color:#FDF7F7" >
			<div class="col-md-12" style="color: red">
			<div class="col-md-4">
			<p>按地区/时间</p>
			<p>
				<a href="#">国产</a>&nbsp; <a href="#">日本</a>&nbsp; <a href="#">欧美</a>&nbsp;
				<a href="#">其他</a>&nbsp;<br> <a href="#">2019</a>&nbsp; <a
					href="#">2018</a>&nbsp; <a href="#">2017</a>&nbsp; <a href="#">.....</a>&nbsp;
			</p>
		</div>
		<div class="col-md-4">
			<p>类型</p>
			<p>
				<a href="#">热血</a>&nbsp; <a href="#">搞笑</a>&nbsp; <a href="#">青春</a>&nbsp;
				<a href="#">电影</a>&nbsp; <a href="#">直播</a>&nbsp; <a href="#">教育</a>&nbsp;
				<a href="#">综艺</a>&nbsp; <a href="#">音乐</a>&nbsp; <a href="#">游戏</a>&nbsp;
				<a href="#">动漫</a>&nbsp; <a href="#">汽车</a>&nbsp; <a href="#">VR</a>&nbsp;
				<a href="#">娱乐</a>&nbsp; <a href="#">公益</a>&nbsp; <a href="#">资讯</a>&nbsp;
				<a href="#">生活</a>&nbsp; <a href="#">科技</a>&nbsp; <a href="#">财经</a>&nbsp;
				<a href="#">少儿</a>&nbsp; <a href="#">体育</a>&nbsp; <a href="#">时尚</a>&nbsp;
				<a href="#">来疯</a>&nbsp; <a href="#">其他</a>&nbsp;
			</p>
		</div>
		<div class="col-md-4">
			<p>按语言</p>
			<p>
				<a href="#">日语</a>&nbsp; <a href="#">国语</a>&nbsp; <a href="#">粤语</a>&nbsp;
				<a href="#">英语</a>&nbsp;<br> <a href="#">韩语</a>&nbsp; <a
					href="#">方言</a>&nbsp; <a href="#">其他</a>&nbsp;
			</p>
		</div>
		</div>
		</div>
		
		<!-- 搜索开始 -->
			<div class="row" style="background-color:#FDF7F7" >
		&nbsp;&nbsp;&nbsp;&nbsp;<?php
			require_once('head.php');
			?>
		
		</div>
		<div class="row">
			<?php

 include_once('dbConn.php');
 //连接数据库  
  connect();
  error_reporting(0);
 
//获取指定的页码
   //判断是否指定第几页，如果没有指定，则显示第1页。
	if(!isset($_GET["page"]))
	$page=1;
	else{
		$page=$_GET["page"];
	}
 //编写sql语句
  $sql = "select * from videos";
  //如果用户提交了表单，则获取用户输入的关键字
    if($_GET['videoname'])  {
	  $videoname = trim($_GET['videoname']);
	  $sql = $sql." where videoname like '%{$videoname}%' ";
  }
  $result = mysql_query($sql) or die('查询失败！'.mysql_error());    
  //获取总行数，用于计算分几页显示
  $totalrows = mysql_num_rows($result);
  $num=mysql_num_rows($result);
//echo $totalrows;
  //定义每页显示的行数
  $rowsperpage =8;
  //计算从表中第几行开始输出
  $start = ($page-1) * $rowsperpage;
  //查询用户，从第$start行开始，共查询$rowsperpage行。
  $sql.= " limit {$start}, {$rowsperpage}";
  //echo $sql.'<br/>';
  //执行sql语句
  $result= mysql_query($sql) or die('查询失败！'.mysql_error());  
  if($totalrows>0)
	  {		
?>
<div class="container">

    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-12">

            <div class="row">
                <div class="col-xs-12 col-lg-12 mlist">
                    <h2 style="color: mediumvioletred;">
           <marquee>  共找到<?php echo $num; ?>个电影~</marquee>
                    </h2>
                    <ul class="list-inline row text-center">
					<?php
				while($row=mysql_fetch_assoc($result))
					{
					?>
				<li class="col-xs-6 col-lg-3">
                         <img src="/final_project/foreground_system/lite/images/<?php
                            echo $row["pic"];?>" class="responsive img-thumbnail" style="width:160px;height:200px"/>
                            <p><a href="show.php?vid=<?php
                            echo $row["vid"];
                            ?>"><?php
                            echo $row["videoname"]; ?></a>
                            </p>
                 </li>
<?php
}
?> 
 </ul>
    <nav class="text-center">
<?php
//计算总页数。如果每页显示的行数>总行数，则只有1页，否则，页数=总行数/每页行数，上取整
  if($rowsperpage >= $totalrows)
      $totalpages = 1;
  else{	  
	  $totalpages = ceil($totalrows / $rowsperpage);
  }
  //如果不是第1页，则显示第一页和上一页的超链接，否则只显示文字
  if($page>1){
	  $first = "<a href=?videoname=$videoname&page=1>首页</a>";
	  $pre = "<a href=?videoname=$videoname&page=".($page-1).">上一页</a>";
  }else{
	  $first = '首页';
	  $pre = '上一页';
  }
  //如果不是最后一页，则显示下一页和最后一页的超链接，否则只显示文字
  if($page<$totalpages){
	  $last = "<a href=?videoname=$videoname&page=$totalpages>尾页</a>";
	  $next = "<a href=?videoname=$videoname&page=".($page+1).">下一页</a>";
  }else{
	  $last = '尾页';
	  $next = '下一页';
  }
  //输出分页
  echo "共{$totalrows}条记录&nbsp;&nbsp;";
  echo "$first"."&nbsp;&nbsp;";
  echo "$pre"."&nbsp;&nbsp;";
  for($i=1;$i<=$totalpages;$i++) 
		echo "<a href=?videoname=$videoname&page=$i>第{$i}页</a>&nbsp;&nbsp;";
  echo "$next"."&nbsp;&nbsp;";
  echo "$last";
  ?>
  </nav>
</div> <!--/.col-xs-6.col-lg-4-->
</div> <!--/row-->
</div> <!--/.col-xs-12.col-sm-12-->

<?php
	}else{
	 
	echo '<h2 style="color:white;">未找到符合条件的结果！3秒后返回首页</h2>';
		 header("refresh:3;url='index.php'"); 
}
?>
</div>  <!--/row-->
</div>


			
		</div>
		
    <!-- 搜索 engding -->
		<!-- 2 engding -->

		<!--
        	作者：1161105403@qq.com
        	时间：2019-03-13
        	描述：
        	
        	导航开始
        -->

		
	</body>

</html>